﻿using BLL.Interface;
using Common.Extensions;
using Microsoft.AspNetCore.Mvc;
using Model.DTO.Member;
using Model.DTO.Public.GetList;
using Model.DTO.Public.OperateId;

namespace TianXiaHuiForumManagementSystem.Controllers.Admin
{
    [Route("Admin/[controller]")]
    [ApiController]
    public class MemberTypeController : ControllerBase
    {
        private readonly IMemberTypeBLL _memberTypeBLL;

        public MemberTypeController(IMemberTypeBLL memberTypeBLL)
        {
            _memberTypeBLL = memberTypeBLL;
        }
        /// <summary>
        /// 添加会员类型
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost, Route("AddMemberType")]
        public async Task<string> AddMemberType(AddMemberTypeDTO param)
        {
            var result = await _memberTypeBLL.AddMemberType(param);
            return result.ToJsonFormat();
        }
        /// <summary>
        /// 删除会员类型
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost, Route("DeleteMemberType")]
        public async Task<string> DeleteMemberType(OperateIdDTO_INT param)
        {
            var result = await _memberTypeBLL.DeleteMemberType(param);
            return result.ToJsonFormat();
        }
        /// <summary>
        /// 编辑会员类型
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost, Route("EditMemberType")]
        public async Task<string> EditMemberType(EditMemberTypeDTO param)
        {
            var result = await _memberTypeBLL.EditMemberType(param);
            return result.ToJsonFormat();
        }
        /// <summary>
        /// 获取会员类型列表
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost, Route("GetMemberTypeList")]
        public async Task<string> GetMemberTypeList(GetListDTO param)
        {
            var result = await _memberTypeBLL.GetMemberTypeList(param);
            return result.ToJsonFormat();
        }
    }
}
